package com.ericsson.springauth.controller;

import java.util.Calendar;
import java.util.List;

import com.ericsson.springauth.model.User;
import com.ericsson.springauth.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created by IntelliJ IDEA.
 * User: lbonacina
 * Date: 4-nov-2010
 * Time: 17.26.58
 */
@Controller
public class MainController {
    
    protected Logger log = Logger.getLogger(this.getClass().getName());

// ------------------------------ FIELDS ------------------------------

    @Autowired
    UserService userService ;
    
    private List<User> userList ;

// -------------------------- OTHER METHODS --------------------------

    public void init() {
        userList = userService.findAll() ;
    }
    
    
    public void doSomething() {
        
        log.info("doing something.") ;
    }
    
    public String gotoSecondPage() {
        
        log.info("navigating to second page.") ;
        return "second" ;
    }

// --------------------- GETTER / SETTER METHODS ---------------------

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }

    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }
}
